﻿using DL.Tools;

namespace DL.AI.AIBT
{
    //执行节点
    public class BTLeaf : BTNode
    {
        //策略
        private readonly IStrategy m_Strategy;

        public BTLeaf(string name, IStrategy strategy, int priority = 0) : base(name, priority)
        {
            if (strategy == null)
            {
                Debugger.EO_LogWarning("传入策略为null，请检查节点" + name);
            }

            m_Strategy = strategy;
        }

        //执行节点执行策略
        public override Status Process()
        {
            Debugger.EO_Log("执行节点：" + name);
            Debugger.EO_Log("执行策略：" + m_Strategy.GetType().Name);
            return m_Strategy.Process();
        }

        public override void Reset() => m_Strategy.Reset();

    }
}